﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Agresso.Interface.Layer.SQL
{
    public class apodettextSQL
    {
        public static string Insert()
        {
            return @"
            INSERT INTO apodettext
           ([break_flag]
           ,[client]
           ,[cur_amount]
           ,[last_update]
           ,[line_no]
           ,[order_id]
           ,[sequence_no]
           ,[short_info]
           ,[user_id]
           ,[voucher_type])
     VALUES
           (@break_flag
           ,@client
           ,@cur_amount
           ,@last_update
           ,@line_no
           ,@order_id
           ,@sequence_no
           ,@short_info
           ,@user_id
           ,@voucher_type)
            ";
        }

        public static string IsExistOrderID()
        {
            return "select count(*) from apodettext where order_id=@order_id";
        }

        public static string IsExistOrderIDClientLineSequenceNo()
        {
            return "select count(*) from apodettext where order_id=@order_id and client=@client and line_no=@line_no and sequence_no=@sequence_no";
        }

        public static string GetPendingApodettext()
        {
            return @"select * from apodettext 
                        where voucher_type = 'SP' 
                        and user_id = 'DESL' and break_flag = '0'";
        }

        public static string UpdateOrderIDandStatus()
        {
            return @"
            update apodettext set order_id=@order_id, break_flag=@break_flag where agrtid = @agrtid and voucher_type = 'SP' and user_id = 'DESL' 
            ";
        }
    }
}
